/*********************************************************************************
  *Copyright (c)    2021   xldeng
  *FileName:        226.cpp.c
  *Author:          xldeng
  *Version:         1.0
  *Date:            2021/2/12 17:46
  *Description:     
  *Others:          
  *Function List:   
     1.…………
  *History:  
     1.Date:
       Author:
       Modification:
**********************************************************************************/
//翻转一棵二叉树。
#include "../header.h"

class Solution {
public:
    TreeNode *invertTree(TreeNode *root) {
        if (root == nullptr)
            return nullptr;
        TreeNode *left = invertTree(root->left);
        TreeNode *right = invertTree(root->right);
        root->right = left;
        root->left = right;
        return root;
    }
};